<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <base href="<%=basePath%>">
      <!-- 宣传委员 -->
   <title>班级活动</title>
    <meta name="viewport" content="width=device-width,initial-scale=1" />
    <meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">
	<link rel="stylesheet" type="text/css" href="css/f/navs.css">
	<link rel="stylesheet" type="text/css" href="css/f/default.css">
	<link rel="stylesheet" type="text/css" href="css/f/assignment.css"/>
    <link href="css/f/stuviewa.css" rel="stylesheet" type="text/css">
	<script src="js/jquery.min.js"></script>
	<script type="text/javascript" src="js/f/jskey_calendar.js"></script>
	<script src="js/f/default.js"></script>
</head>

<body>
	<div class="all">
		<jsp:include page="/nav.jsp"></jsp:include>
        <div class="rightall float-left">
  			<div class="already">
	            <div class="already-title">
	            	<input type="hidden" value="${error_msg }" name="errorMsg" />
	                <div class="left">添加班级活动</div>
	            </div>
       			<form action="cadre/appendClassActive.do" method="post" class="float-left">
		       			<div class="margin-top a-width float-left margin-left" style="margin-left:20%">
		       				<p>活动名称:</p><input type="text" name="activityTitle" class="datetime">
		       				<p>开始时间:</p><input class="datetime" type="text" value="" name="createTime" onclick="$jskey.calendar.show(this, {skin:'default',format:'yyyy-MM-dd HH:mm:ss',show:'yyyy-MM-dd HH:mm:ss'})"/>
		       				<p>截止时间:</p><input class="datetime" type="text" value="" name="deadline" onclick="$jskey.calendar.show(this, {skin:'default',format:'yyyy-MM-dd HH:mm:ss',show:'yyyy-MM-dd HH:mm:ss'})" />
		       			</div>
		       			<div class="margin-top  a-width float-left margin-left">
		       				<p>活动内容:</p><textarea class="content" rows="5" cols="50" name="activityContent" style="margin-top:0px;height:140px"></textarea>
		       				<button type="submit" class="btn-style submit" style="width:100%" onclick="return aler('请确认提交')">发布</button>
		       			</div>
       			</form><br class="float-clear">
       		</div>
        	 <div class="already">
	            <div class="already-title">
	                <div class="left float-left">班级活动</div>
	            </div>
	       		 <table>
	  				<tr class="tr-style-head">
		  				<td>活动标题</td>
		  				<td>活动内容</td>
		  				<td>开始时间</td>
		  				<td>截止时间</td>
		  				<td>状态</td>
		  				<td>操作</td>
	  				</tr>
	  				
				<c:forEach  var="ca" items="${ClassActivity}">
	  				<tr class="tr-style">
		  				<td>${ca.activityTitle }</td>
		  				<td>${ca.activityContent }</td>
		  				<td>${ca.createTime }</td>
		  				<td>${ca.deadline }</td>
		  				<td>
		  					<c:if test="${ca.activityState==1 }"><span class="a-color-blue">报名中</span></c:if>
		  					<c:if test="${ca.activityState==2 }"><span class="a-color-blue">活动中</span></c:if>
		  					<c:if test="${ca.activityState==3 }">活动结束</c:if>
		  				</td>
		  				<td>
		  					<c:if test="${ca.activityState==1 }">
		  						<a href="cadre/activityState.do?id=${ca.classActivityId }&state=2" class="a-color-blue" onclick="return aler('请确认提交')">活动中</a>
		  					</c:if>
		  					<c:if test="${ca.activityState==2 }">
		  						<a href="cadre/activityState.do?id=${ca.classActivityId }&state=3" style="color:red;" onclick="return aler('请确认提交')">活动结束</a>
		  					</c:if>
		  					<c:if test="${ca.activityState==3 }"><span style="color:grey;">无操作</span></c:if>
		  				</td>
	  				</tr>
	  			</c:forEach>
	  			</table>
                <c:if test="${pages > 1 }">
	            	<div class="previous">
	              	 		<c:if test="${pageNo > 1}"> <a href="cadre/classActivity.do?pageNo=${pageNo-1 }">上一页</a> </c:if>
	              	 		<c:forEach var="p" begin="1" end="${pages }" step="1">
	              	 		<c:if test="${p==pageNo }">
	                   			<span style="font-size:18px;color:#446ee6;">&nbsp;${p}&nbsp;</span>
	                   		</c:if>
	                   		<c:if test="${p!=pageNo }">
	                   			<a href="cadre/classActivity.do?pageNo=${p }" >&nbsp;${p}&nbsp;</a>
	                   		</c:if>
	               		 </c:forEach>
	                	<c:if test="${pageNo < pages}"><a href="cadre/classActivity.do?pageNo=${pageNo+1 }">下一页</a></c:if>
	                </div>
               </c:if>
       		 </div>
       	</div>	
     </div>		
  </body>
</html>
